<?php

class catelogue extends cls_parent {
    public $n;
    public function getCategory($i) {
        $sql = "select * from categories where cat_id= $i";        
        return $this->db->fetchOne($sql);
    }
    

    public function getProduct($i,$v) {
        $sql = "SELECT products.pro_id as pro_id1, products.name as name1, products.price as price1, products.image as image1   "
                . "FROM products inner join categories on products.cat_id = categories.cat_id "
                . "where (products.cat_id=$i) or (categories.parent_id=$i) limit $v,6";
        return $this->db->fetchAll($sql);
    }
    public function getProduct1($i) {
        $sql = "SELECT products.pro_id as pro_id1, products.name as name1, products.price as price1, products.image as image1   "
                . "FROM products inner join categories on products.cat_id = categories.cat_id "
                . "where (products.cat_id=$i) or (categories.parent_id=$i)";     
        return $this->db->fetchAll($sql);
    }

}
